﻿namespace Chameleon.Samples
{
	using Chameleon.Data;
	using System.Configuration;
	
	/// <summary>
	/// Handles creation of a Linq to SQL data context.
	/// </summary>
	
	public static class SqlContext
	{
		/// <summary>
		/// Config file key that contains the connection string.
		/// </summary>
		
		const string Connection = "SqlSample";


		/// <summary>
		/// Creates and returns a new depository based on this context type using the defined connection string.
		/// </summary>
		
		public static IDepository Depository()
		{
			var connection = ConfigurationManager.ConnectionStrings[Connection].ConnectionString;
			return new SqlDepository( connection );
		}
	}
}
